<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>批发增加修改</title>
<link rel="stylesheet" href="../../res/layui/css/layui.css">
<script type="text/javascript" src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>

</head>
<body>
	<form id="form" class="layui-form" action="../../listenBranchWholesale/addUpdate.action" method="post" style="margin-top: 10px;">
		<input type="hidden" name="bwId" id="id"/><!-- 隐藏hidden -->
	 	
	 	<div class="layui-form-item" style="width:70%;">
	      <label class="layui-form-label">公司名称:</label>
	      <div class="layui-input-block">
		     <select class="layui-input" name="companyId" id="companyId" lay-verify="required|companyId">
		     	<option value="">-请选择-</option>
		     </select>
		    </div>
	  	</div>
	  	
	  <div class="layui-form-item layui-form-text" style="width:70%;">
	    <label class="layui-form-label">批发时间:</label>
	    <div class="layui-input-block">
	      <input name="bwTimeString" lay-verify="required|bwTimeString" placeholder="请输入批发时间" class="layui-input" id='bwTimeString'/>
	    </div>
	    </div>
	    <div class="layui-form-item" style="width:70%;">
	    <label class="layui-form-label">销售总金额:</label>
		    <div class="layui-input-block">
		      <input name="bwPrice" lay-verify=required|bwPrice" lay- autocomplete="off" placeholder="请输入销售总金额" class="layui-input" type="text" id='bwPrice'>
		    </div>
	  	</div>
	  	 <div class="layui-form-item" style="width:70%;">
	    <label class="layui-form-label">销售总数量:</label>
		    <div class="layui-input-block">
		      <input name="bwNumber" lay-verify="required|bwNumber" lay- autocomplete="off" placeholder="请输入销售总金额" class="layui-input" type="text" id='bwNumber'>
		    </div>
	  	</div>
	  

	   	<div class="layui-form-item" style="width:70%;">
	      <label class="layui-form-label">是否有效:</label>
	      <div class="layui-input-block">
		     <select class="layui-input" name="isva" id="isva" lay-verify="required">
		     	<option value="">-请选择-</option>
		     	<option value="1">有效</option>
		     	<option value="2">无效</option>
		     </select>
		    </div>
	  	</div>
	
	 <br/>
	  <div class="layui-form-item" style="width:70%;">
	    <div class="layui-input-block">
	      <button class="layui-btn" lay-submit lay-filter="formDemo" id="sub">立即提交</button>
	      <a href="javascript:exit();" class="layui-btn">关闭</a>
	    </div>
	   </div>
	</form>
<script src="../../res/layui/layui.all.js" charset="utf-8"></script>
<script>
layui.use('laydate',function(){
	  var laydate = layui.laydate;
	  //执行一个laydate实例
	  laydate.render({
		  elem:'#bwTimeString'
	  	,theme: 'molv'
	  });

	});

layui.use(['form', 'layedit', 'laydate'], function(){
  var form = layui.form
  ,laydate = layui.laydate
  ,layer = layui.layer
  ,layedit = layui.layedit;
	/* 公司查询所有 */
	var url="../../listenCompany/queryAllzwm.action";
	var data=null;
	$.post(url,data,function(mes){
		$.each(mes,function(i,item){
			/* alert(item.stateId+"======"+item.stateName+$("#stateId").html()) */
			$("#companyId").append("<option value='"+item.companyId+"'>"+item.companyName+"</option>");
			form.render();
		})
	},"json")
  
  //创建一个编辑器
  var editIndex = layedit.build('LAY_demo_editor');
 
  //自定义验证规则
  form.verify({
	  routeContent: function(value){
      if(value.length < 2 || value.length>6){
        return '内容不能少于2个字符和大于6个字符';
      }
    }
   
  });
     
//监听提交
  form.on('submit(formDemo)', function(data){
	  var index=parent.layer.getFrameIndex(window.name);
	  parent.layer.close(index);
  });
   
 
 
  
});
layui.use('upload', function(){
	  var $ = layui.jquery
	  ,upload = layui.upload;
	  
	  
	
});
function load(){
	var form = layui.form;
	form.render();
}
</script>
</body>
</html>